package com.thirdgroup.dao.impl;

import com.thirdgroup.dao.RbacDao;
import com.thirdgroup.dao.base.BaseDAO;
import com.thirdgroup.pojo.entity.Permission;

import java.util.List;

public class RbacDaoImpl extends BaseDAO<Permission> implements RbacDao {
    @Override
    public List<Permission> rbac(String id){
        String sql="select DISTINCT p.permission_id permissionId,p.name,p.url,p.parent_id parentId, p.type\n" +
                "from manager_info m,role r,role_permission rp,permission p\n" +
                "where m.role_id=r.role_id and r.role_id=rp.role_id and rp.permission_id=p.permission_id and managerID=?\n" +
                "order by p.permission_id;";
        Object[] params ={id};
        return findAll(sql,params);

    }
}
